<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.js"></script>
  <title>Document</title>
</head>
<body>
  <script>
    $(document).ready(function () {
      function ajax_test() {
        $.ajax({
          url: "./test.json", //json文件位置
          type: "GET", //请求方式为get
          dataType: "json", //返回数据格式为json
          success: function (data) { //请求成功完成后要执行的方法 
            console.log('data',data);
          },
          error:function(err){
            console.log('err',err);
          }
        })
      }
      ajax_test()
    })
  </script>
</body>

</html>